package net.adetech.crj.service;

import com.alibaba.fastjson.JSONObject;
import net.adetech.crj.utils.ApiUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;


@Service("interface.call")
public class InterfaceService implements BaseService {

    @Autowired
    ApiUtils apiUtils;

    @Override
    public Map<String, Object> invoke(Map<String, Object> params) {
        String funccode = (String)params.get("funccode");
        String args = (String)params.get("args");
        JSONObject response = apiUtils.call(funccode,args);
        Map<String,Object> result = new HashMap<String, Object>();
        result.put("response",response);
        return result;
    }
}
